//
//  ProduceOrderView.swift
//  DSHCMerchant
//
//  Created by 罗德良 on 2018/4/17.
//  Copyright © 2018年 袋鼠好车. All rights reserved.
//

import UIKit

class ProduceOrderView: UIView {

    typealias sureOrcancleBlock = (_ boolValue:Bool) -> Void
    
    @IBOutlet var titleLabel: UILabel!
    
    @IBOutlet var priceTF: UITextField!
    
    @IBOutlet var codeTF: UITextField!
    
    @IBOutlet var remarksTF: UITextField!
    
    @IBOutlet var cancleBtn: UIButton!
    
    @IBOutlet var saveBtn: UIButton!
    
    var tapSureOrcancle:sureOrcancleBlock?
    
    func callBackBlock(_ block: @escaping sureOrcancleBlock) {
        
        tapSureOrcancle = block
    }

    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.frame = CGRect(x:0, y:0, width:ScaleWidth(300),height:ScaleHeight(200));
        self.center = CGPoint(x: kScreenWidth/2, y: kScreenHeight/2)
        self.roundCorner(radius: 5)
    }
    
    class func getProduceOrderPopView() -> ProduceOrderView {
        return UIView.creatFromNIB(By: "ProduceOrderView") as! ProduceOrderView
    }
    
    @IBAction func saveBtnPress(_ sender: UIButton) {
//        if (self.priceTF.text == "") || (self.codeTF.text == "") || (self.remarksTF.text == "") {
//            MBProgressHUD.alertShow(in: self, message: "请填写完整再提交", hidenAfter: 0.8, mode: MBProgressHUDMode.text)
//            return
//        }
        if tapSureOrcancle != nil {
            self.tapSureOrcancle!(true)
        }
    }
    
    @IBAction func cancleBtnPress(_ sender: UIButton) {
        if tapSureOrcancle != nil {
            tapSureOrcancle!(false)
        }
    }
}



